package com.qdu.servlet;

import com.qdu.dao.UsersDao;
import com.qdu.entity.Activity;
import com.qdu.entity.Log;
import com.qdu.entity.Users;
import com.qdu.service.ActivityService;
import com.qdu.service.impl.LogServiceImpl;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 在一个页面删除完这个日志和跳转到管理员页面之前的servlet
 *
 * @author Lenovo
 */
@WebServlet("/adtl")
public class afterDeleteThisLog extends HttpServlet{

    LogServiceImpl logserviceimpl=new LogServiceImpl();
    ActivityService activityService=new ActivityService();
    UsersDao userdao=new UsersDao();
    
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        
        List<Log> logList=logserviceimpl.getAllLog();
        req.setAttribute("logList", logList);//将所有日志放入属性
        
        List<Activity> activity=activityService.findAllActivity();
        req.setAttribute("managerlist", activity);
        
        List<Users> list=new ArrayList<>();
        List<Users> users=userdao.getAllUsers();
         for(Users u:users)//只显示通过审核的
                    {
                        if(u.getUstatus()==1)
                        {
                            list.add(u);
                        }
                    }
         req.setAttribute("userList",list);
        
        req.getRequestDispatcher("manager.jsp").forward(req, resp);
        
    }
}
